﻿using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using dpa.Library.Services;

namespace dpa.Library.ViewModels;

public partial class MainWindowViewModel(
    IRootNavigationService rootNavigationService,
    IPoetryStorage poetryStorage,
    IMenuNavigationService menuNavigationService,
    IFavoriteStorage favoriteStorage) : ViewModelBase
{
    [ObservableProperty] private ViewModelBase _content;

    /*public ViewModelBase Content
    {
        get => _content;
        set => SetProperty(ref _content, value);
    }*/

    [RelayCommand]
    private void OnInitialized()
    {
        rootNavigationService.NavigateTo(RootNavigationConstant.MainView);
        if (!poetryStorage.IsInitialized || !favoriteStorage.IsInitialized)
        {
            rootNavigationService.NavigateTo(RootNavigationConstant.InitializationView);
        }
        else
        {
            rootNavigationService.NavigateTo(RootNavigationConstant.MainView);
            menuNavigationService.NavigateTo(MenuNavigationConstant.TodayView);
        }
    }
}